package com.itheima.controller;

import com.itheima.domain.Role;
import com.itheima.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/role")
public class RoleController {
    //注入Service对象
    @Autowired
    private RoleService roleService;
    /**
     * 查询所有角色
     */
    @RequestMapping("/list")
    public String list(Model model){
        List<Role> list = roleService.findAll();
        model.addAttribute("list",list);
        System.out.println("在码云上修改了次行代码");
        return "list";
    }
}